﻿<PageFunction
    x:Class="Milkify.Views.SettingsControl"
    x:TypeArguments="sys:String"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:prop="clr-namespace:Milkify.Properties"
    xmlns:mv="clr-namespace:Milkify.Views"
    Title="Settings">
    <DockPanel>
        <Grid
            DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Button
                Grid.Column="0"
                Content="OK"
                Click="ButtonOK_Click" />
            <Button
                Grid.Column="1"
                Content="Cancel"
                IsCancel="True"
                Click="ButtonCancel_Click"/>
        </Grid>
        <TabControl>
            <TabItem Header="General">
                <ScrollViewer
                    VerticalScrollBarVisibility="Auto">
                    <Grid
                        VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition SharedSizeGroup="Label" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock Grid.ColumnSpan="2" Style="{DynamicResource HeadingTextStyle1}">General</TextBlock>
                        <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Style="{DynamicResource HeadingTextStyle2}">Appearance</TextBlock>
                        <TextBlock Grid.Column="0" Grid.Row="2" Style="{DynamicResource ParagraphTextStyle}">Skin: </TextBlock>
                        <ComboBox
                            Grid.Column="1"
                            Grid.Row="2"
                            ItemsSource="{Binding Skins}"
                            IsSynchronizedWithCurrentItem="True" />
                        <TextBlock Grid.Row="3" Style="{DynamicResource ParagraphTextStyle}">Show in taskbar: </TextBlock>
                        <CheckBox
                            Grid.Column="1"
                            Grid.Row="3"
                            VerticalAlignment="Center"
                            IsChecked="{Binding Settings.ShowInTaskbar}" />
                        <TextBlock Grid.Row="4" Style="{DynamicResource ParagraphTextStyle}">Pin to desktop: </TextBlock>
                        <CheckBox
                            Grid.Column="1"
                            Grid.Row="4"
                            VerticalAlignment="Center"
                            IsChecked="{Binding Settings.PinToDesktop}" />
                        <TextBlock Grid.ColumnSpan="2" Grid.Row="5" Style="{DynamicResource HeadingTextStyle2}">Tasks</TextBlock>
                        <TextBlock Grid.Column="0" Grid.Row="6" Style="{DynamicResource ParagraphTextStyle}">Default due date: </TextBlock>
                        <TextBox
                            Grid.Column="1"
                            Grid.Row="6"
                            Text="{Binding Settings.DefaultDueDate}" />
                    </Grid>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="Application Hotkeys">
                <ScrollViewer
                    VerticalScrollBarVisibility="Auto">
                    <Grid
                        VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition SharedSizeGroup="Label" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock Grid.ColumnSpan="2" Style="{DynamicResource HeadingTextStyle1}">Application hotkeys</TextBlock>
                        <TextBlock 
                            Grid.Row="1" 
                            Grid.ColumnSpan="2" 
                            TextWrapping="Wrap"
                            Style="{DynamicResource ParagraphTextStyle}">
                            These keyboard shortcuts will bring Milkify into focus if it has been minimized
                            or minimized to tray, and will trigger a specific action.
                        </TextBlock>
                        <TextBlock Grid.Row="2" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Add task</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="2" Grid.Column="1" Text="{Binding Settings.AddTaskHotkey}" />
                        <TextBlock Grid.Row="3" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Search tasks</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="3" Grid.Column="1" Text="{Binding Settings.SearchTaskHotkey}" />
                    </Grid>
                 </ScrollViewer>
            </TabItem>
            <TabItem Header="Keyboard Shortcuts">
                <ScrollViewer
                    VerticalScrollBarVisibility="Auto">
                    <Grid
                        VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition SharedSizeGroup="Label" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock Grid.ColumnSpan="2" Grid.Row="0" Style="{DynamicResource HeadingTextStyle1}">Keyboard shortcuts</TextBlock>
                        <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Style="{DynamicResource HeadingTextStyle2}">Navigation</TextBlock>
                        <TextBlock Grid.Row="2" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Home</TextBlock>
                        <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="1">
                            <TextBlock Text="G + " VerticalAlignment="Center" />
                            <mv:KeyboardShortcutControl Text="{Binding Settings.GoHomeShortcut}" />
                        </StackPanel>
                        <TextBlock Grid.Row="3" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Go to list</TextBlock>
                        <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="1">
                            <TextBlock Text="G + " VerticalAlignment="Center" />
                            <mv:KeyboardShortcutControl Text="{Binding Settings.GoToTaskListShortcut}" />
                        </StackPanel>
                        <TextBlock Grid.Row="4" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Go to tag</TextBlock>
                        <StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1">
                            <TextBlock Text="G + " VerticalAlignment="Center" />
                            <mv:KeyboardShortcutControl Text="{Binding Settings.GoToTagShortcut}" />
                        </StackPanel>
                        <TextBlock Grid.ColumnSpan="2" Grid.Row="5" Style="{DynamicResource HeadingTextStyle2}">Task Editing</TextBlock>
                        <TextBlock Grid.Row="6" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Complete</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="6" Grid.Column="1" Text="{Binding Settings.CompleteTaskShortcut}" />
                        <TextBlock Grid.Row="7" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Postpone</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="7" Grid.Column="1" Text="{Binding Settings.PostponeTaskShortcut}" />
                        <TextBlock Grid.Row="8" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Rename</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="8" Grid.Column="1" Text="{Binding Settings.ChangeTaskNameShortcut}" />
                        <TextBlock Grid.Row="9" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Change due date</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="9" Grid.Column="1" Text="{Binding Settings.ChangeTaskDueDateShortcut}" />
                        <TextBlock Grid.Row="10" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Change recurrence</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="10" Grid.Column="1" Text="{Binding Settings.ChangeTaskRepeatShortcut}" />
                        <TextBlock Grid.Row="11" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Change estimate</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="11" Grid.Column="1" Text="{Binding Settings.ChangeTaskEstimateShortcut}" />
                        <TextBlock Grid.Row="12" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Change tags</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="12" Grid.Column="1" Text="{Binding Settings.ChangeTaskTagsShortcut}" />
                        <TextBlock Grid.Row="13" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Change URL</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="13" Grid.Column="1" Text="{Binding Settings.ChangeTaskUrlShortcut}" />
                        <TextBlock Grid.Row="14" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Change location</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="14" Grid.Column="1" Text="{Binding Settings.ChangeTaskLocationShortcut}" />
                        <TextBlock Grid.Row="15" Grid.Column="0" Style="{DynamicResource ParagraphTextStyle}">Add note</TextBlock>
                        <mv:KeyboardShortcutControl Grid.Row="15" Grid.Column="1" Text="{Binding Settings.AddTaskNoteShortcut}" />
                    </Grid>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="Network">
                <ScrollViewer
                    VerticalScrollBarVisibility="Auto">
                    <Grid
                        VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition SharedSizeGroup="Label" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock Grid.ColumnSpan="2" Style="{DynamicResource HeadingTextStyle1}">Network</TextBlock>
                        <TextBlock Grid.Row="1" Style="{DynamicResource ParagraphTextStyle}">Use proxy: </TextBlock>
                        <CheckBox
                            Name="CheckUseProxy"
                            Grid.Column="1"
                            Grid.Row="1"
                            VerticalAlignment="Center"
                            IsChecked="{Binding Settings.UseProxy}" />
                        <TextBlock Grid.Row="2" Style="{DynamicResource ParagraphTextStyle}">Proxy address: </TextBlock>
                        <TextBox
                            Grid.Column="1"
                            Grid.Row="2"
                            IsEnabled="{Binding IsChecked,ElementName=CheckUseProxy}" 
                            Text="{Binding Settings.ProxyAddress}" />
                    </Grid>
                </ScrollViewer>
            </TabItem>
        </TabControl>
    </DockPanel>
</PageFunction>
